﻿using System;
public class Class1
{
    private static Random random = new Random();

    public static void MakeRandomNumber(int[] numbers)
    {
        int i, value;

        for (i = 0; i < 10; i++) numbers[i] = 0;

        for (i = 1; i < 10; i++)
        {
            value = random.Next(0, 9);
            numbers[value] = numbers[value] + 1;
        }
    }
}

public class Class2
{
    public static void DrawHistogram(int[] numbers)
    {
        int max, height, i;
        max = numbers[0];
        for (i = 1; i < 10; i++)
            if (numbers[i] > max) max = numbers[i];

        height = max;
        while (height > 0)
        {
            for (i = 0; i < 10; i++)
                if (numbers[i] >= height)
                    System.Console.Write('x');
                else
                    System.Console.Write(' ');
            System.Console.WriteLine();
            height = height - 1;
        }

        for (i = 0; i < 10; i++) Console.Write('-');
        System.Console.WriteLine();
        for (i = 0; i < 10; i++) Console.Write(i);
        Console.WriteLine();
    }
}


public class Class3
{
    public static void Main()
    {
        int[] randomNumber = new int[10];
        int ch = '1';
        while (ch == '1')
        {
            Class1.MakeRandomNumber(randomNumber);
            Class2.DrawHistogram(randomNumber);
            Console.WriteLine();
            Console.WriteLine("For a new run, type '1', followed by return");
            string s = System.Console.ReadLine();
            ch = s.ToCharArray()[0];
        }
    }
}

